<?php
ob_start();
session_start();

	include "../../includes/constantes.inc.php";
	include "../../" . DIR_INCLUDE . "/function.inc.php";
	include "../../pdo.config.php";
	
	
	
	
	
	
	$pdo = new PDO($driver.':'.$dns,$user,$passwd);








	header("Content-type: image/png");
	
	ob_clean();
	
	
	
	
	
	
	
	
	
	
	$req = $pdo->prepare("SELECT * FROM forum_mp_text JOIN forum_mp AS fmp ON mp_id=mp_post_id WHERE mp_receveur=:id AND mp_lu='0' AND mid_delete_post!=:id");
	
	
	
	
	
	
	
	
	
	
	$id = (isset($_SESSION["id"])) ? $_SESSION["id"] : -1;
	
				$req->bindParam(":id",$id);
	
	
	
	
	
	
	
	
	
	
	
	
						$req->execute();
	
	
	
	
	
	
	
	
	
		
	
	$nb = $req->rowCount();

				if($nb > 0)
				{
		
		
		
		
		
		
		
		
					$image = imagecreatefrompng("../../" . DIR_DESIGN . "/" . getDesignName() . "/images/header/envelloppe_non_lu_alert.png");
		
		
		
		
		
		
		
		
		
		
			$couleur_text = imagecolorallocate($image,255,0,0);
		
		
		
		
		
		
		
		
		
		if(intval($nb) < 10)
			imagestring($image,2,15,-2,$nb,$couleur_text);
		else if(intval($nb) < 100)
			imagestring($image,2,11.5,-2,$nb,$couleur_text);
		else	
			imagestring($image,2,11.5,-2,'99+',$couleur_text);
			
			
			
				}
					else
				{
		
		
		
		
		
		
		
		
		
		
		$image = imagecreatefrompng("../../" . DIR_DESIGN . "/" . getDesignName() . "/images/header/envelloppe_lu_alert.png");
		
		
	}
	
	
	
	
	
	
	
	
	
	
	
	
	$noir = imagecolorallocate($image,0,0,0);
			imagecolortransparent($image,$noir);
	
	
	
	
	
	
	
				$req->closeCursor();
				
				
				
				
				
			
				
	imagepng($image);
	
	
?>